// pages/post_recom/post_recom.js
const app = getApp(), core = require('../../utils/core'), util = require('../../utils/util');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [],
    url: '',
    listMore: {page:1},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let typeDatas = {
      'similar': {
        url: '/xilujob.job/similar_jobs',
        title: '相似职位',
      }, //相似职位
      'applied': {
        url: '/xilujob.job/applied_jobs',
        title: '相似投递'
      }//同样投递过
    };
    let typeData = typeDatas[options.type];
    if(!typeData) {
      wx.navigateBack();
      wx.showToast({title: '参数错误',icon:'none'});
      return;
    }
    let url = typeData.url, title = typeData.title;
    this.setData({url, jobId: options.job_id});
    wx.setNavigationBarTitle({title});
    this.fetch();
  },
  fetch() {
    util.fetch(this,this.data.url,{id: this.data.jobId},'listMore','list','jobs');
  }

});
